{extend name="default/template/base_index" /}

{block name="area_header"}
<script type="text/javascript" src="__CDN__/jquery-datetimepicker/jquery.datetimepicker.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="__CDN__/jquery-datetimepicker/jquery.datetimepicker.css">
<link type="text/css" rel="stylesheet" href="__CDN__/select2/4.0.0/css/select2.min.css" />
<link type="text/css" rel="stylesheet" href="__CDN__/select2/4.0.0/css/cosmo-skin.css" />
<style>
.select2{ width:260px !important;z-index: 99; }
.select2-hidden-accessible{ width:1px !important; }
.select2-selection{ border-color:#ddd !important;height:30px !important; }
.select2-selection .select2-selection__rendered{ line-height: 13px !important;height:30px !important; }
.select2-dropdown{ border-color: #ddd !important; }
.select2-container{ z-index: 99999999;border:1px solid #ddd; }
</style>
{/block}

{block name="area_body"}
	{include file="default/Widget/topbar" /}
	<div class="admin-main container-fluid">
		{include file="default/Widget/left" /}
		<div class="admin-main-content">
			{include file="default/Widget/breadcrumb" /}
			<div class="table-responsive well">
	<!-- 过滤\查询按钮 -->
	<div class="filter-controls">
		<form action="{:url('Suggest/index')}" class="memberForm form-inline" method="post">
			<div class="form-group">
				<div class="input-group ">
					<div class="input-group-addon input-sm"><i class="fa fa-user"></i>用户</div>
					<select id="user_select2" name="uid" class="input-sm">
	          {if condition="$uid gt 0"}<option value='{$uid}' selected="selected">[id:{$uid}] {$nickname}</option>{/if}
	     		 </select>
					</div>
			</div>
			<div class="form-group ">
				<div class="input-group">
					<div class="input-group-addon input-sm">
						时间
						<i class="fa fa-calendar"></i>
					</div>
					<input type="text" name="startdatetime" id="startdatetime" class="form-control input-short input-sm" value="{$startdatetime}" />
					<div class="input-group-addon input-sm">
						<i class="fa fa-long-arrow-right"></i>
					</div>
					<input type="text" name="enddatetime" id="enddatetime" class="form-control input-short input-sm" value="{$enddatetime}" />
				</div>
				<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i>{:L('BTN_SEARCH')}</button>
			</div>
			<!--<div class="form-group">-->
				<!--<label class="control-label">&nbsp;</label>-->
				<!--<div class="input-group">-->
					<!--<button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-search"></i>查询</button>-->
				<!--</div>-->
			<!--</div>-->
		</form>
	</div>


	<table class="table table-striped table table-hover  table-condensed">
		<thead>
			<tr>
				<!-- <th style="width:40px;">
					<input type="checkbox" class="selectall" onclick="myUtils.selectall(this,'.selectitem');" />
				</th> -->
				<th width="180">
					时间</th>
				<th width="400">
					内容</th>
				<th>
					用户</th>
				<th>
					电话</th>
				<th>
					邮箱</th>
				<th>
					操作</th>
			</tr>
		</thead>
		<tbody>
			{empty name="list"}
				<tr>
					<td colspan="6" class="text-center">{:L('NO_DATA')}</td>
				</tr>
				{else/}
				{volist name="list" id="vo"}
					<tr>
						<!-- <td><input type="checkbox" value="{$vo.id}" name="id[]" class="selectitem" /></td> -->

						<td>{$vo.create_time|date='Y-m-d h:i:s',###}</td>
						<td>{$vo.text}</td>
						<td><a href="{:url('Member/view',['id'=>$vo.uid])}?ret_url=__SELF__">
								<img class="m-avatar" src="{:app\\src\\base\\helper\\ConfigHelper::getAvatarUrl($vo.uid,60)}" />
								{$vo.nickname|default='--'}
							</a></td>
						<td>{$vo.tel}</td>
						<td>{$vo.email}</td>
						<td>
							<a href="{:url('Admin/Email/send')}?to_email={$vo.email}&return_url={:url('admin/suggest/index',$params)}" class="btn btn-danger btn-sm" >
								发送邮件</a>
						</td>

				{/volist}
			{/empty}
		</tbody>
	</table>
	<div>{$show}</div>
</div>
		</div>
		<!-- END admin-main-content -->
	</div>
		<!-- END admin-main-->

<script src="__CDN__/select2/4.0.0/js/select2.min.js"></script>
<script src="__CDN__/select2/4.0.0/js/i18n/zh-CN.js"></script>
<script type="text/javascript">
	$(function() {

		$('#startdatetime,#enddatetime').datetimepicker({
        lang: 'ch',
        format:'Y-m-d H:i:s',
        allowBlank : true,
		});
		$("#user_select2").select2({
          placeholder: "输入用户id或昵称查询"	,
          language: "zh-CN",
          ajax: {
              url: "{:url('Member/select')}",
              dataType: 'json',
              delay: 250,
              data: function (params) {
                  var queryParameters = {
                      q: params.term
                  }
                  return queryParameters;

              },
              processResults: function (result, page) {
                  if(!result.data){
                      result.data = new Array();
                      result.data['nodata']="无相关数据";
                  }
                  result.data.unshift({id:0,uid:0,nickname:'',head:''});
                  return {
                      results: result.data
                  };
              },
              cache: true
          },
          minimumInputLength: 0,
          templateSelection: function (repo) {
          	if(repo.id){
		          return repo.nickname ? '[id:'+repo.id+'] '+repo.nickname: (repo.text ? repo.text : '[id:'+repo.id+']');
		        }else{
		          return repo.text;
		        }
          },
          templateResult: function (repo) {

              if (repo.loading) return repo.text;
              if(repo.nodata) return repo.nodata;
//    				var markup = '<div>'+repo.nickname+'</div>';
               var markup = parseInt(repo.id) ? '<div><img src="'+repo.head+'" style="width:30px;height:30px;"/>[id:'+repo.id+'] '+repo.nickname+'</div>' : '<div>清除选择 X</div>';
              return $(markup);
          },
      });
	});
</script>
{/block}

{block name="area_footer"}

{/block}
